package org.nightrunner.d3.service.impl;

import java.io.Serializable;
import java.util.List;

import org.nightrunner.d3.dao.IGuideInfoDao;
import org.nightrunner.d3.entity.GuideInfo;
import org.nightrunner.d3.model.DefaultPaginationInfo;
import org.nightrunner.d3.model.IPaginationInfo;
import org.nightrunner.d3.model.PaginationModel;
import org.nightrunner.d3.service.IGuideInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * GuideInfo Service implementation
 * 
* @author NigthRunner
 * @date 2012-7-26
 * @version 1.0
 */
@Service
public class GuideInfoService implements IGuideInfoService {

	@Autowired
	private IGuideInfoDao guideInfoDao;

	public IGuideInfoDao getGuideInfoDao() {
		return guideInfoDao;
	}

	public void setGuideInfoDao(IGuideInfoDao bureauDao) {
		this.guideInfoDao = bureauDao;
	}

	public Serializable addGuideInfo(GuideInfo bureau) {
		return guideInfoDao.save(bureau);
	}

	public GuideInfo getGuideInfo(String bureauId) {
		return guideInfoDao.get(bureauId);
	}

	public List<GuideInfo> getAllGuideInfo() {
		return guideInfoDao.list();
	}

	public void deleteGuideInfo(GuideInfo guideInfo) {
		guideInfoDao.delete(guideInfo);
	}

	public PaginationModel<List<GuideInfo>> getGuideInfo() {
		IPaginationInfo paginationInfo = new DefaultPaginationInfo();
		paginationInfo.setCurrentPage(0);
		paginationInfo.setRowSize(10);
		return getGuideInfo(paginationInfo);
	}

	public PaginationModel<List<GuideInfo>> getGuideInfo(
			IPaginationInfo pagination) {
		return guideInfoDao.find(pagination);
	}

	public void updateGuideInfo(GuideInfo guideInfo) {
		guideInfoDao.merge(guideInfo);
	}
}
